/**
 * 游戏类，游戏中所有的管理类都从这里取
 */
class Game {
    public static isDebug: Boolean;
    //游戏Stage
    public static Stage: egret.Stage;

    public static initGameSettings() {
        Game.isDebug = true;
        egret.DisplayObject.defaultTouchEnabled = false
        Game.Stage = egret.MainContext.instance.stage;
        Game.Stage.frameRate = 60;  //帧率
        gf.LayerMgr.DefaultUILayer.addChild(fairygui.GRoot.inst.displayObject);       //fgui root

        egret.ImageLoader.crossOrigin = "anonymous";//跨域加载图片设置
        Game.Camera.init(Game.Stage);
        Game.Camera.addLayers(gf.LayerMgr.MapLayer, gf.LayerMgr.DefaultUILayer);
    }
    //场景管理
    public static get SceneMgr(): gf.SceneMgr {
        return gf.SceneMgr.getInstance();
    }
    //对话框管理
    public static get DialogMgr(): gf.DialogMgr {
        return gf.DialogMgr.getInstance();
    }
    //网络模块
    public static get NetworkEngine(): gf.NetworkEngine {
        return gf.NetworkEngine.getInstance();
    }
    //事件系统
    public static get EventSystem(): gf.EventSystem {
        return gf.EventSystem.getInstance();
    }
    //资源加载
    public static get ResMgr(): gf.ResMgr {
        return gf.ResMgr.getInstance();
    }
    //相机
    public static get Camera(): gf.Camera {
        return gf.Camera.getInstance();
    }
    //全屏
    public static fullScreen(): void {
        let el = document.documentElement as any;
        let rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
        if (typeof rfs != "undefined" && rfs) {
            rfs.call(el);
        };
        return;
    }
    //退出全屏
    public static exitScreen() {
        let cfs = document as any;
        if (cfs.exitFullscreen) {
            cfs.exitFullscreen();
        }
        else if (cfs.webkitCancelFullScreen) {
            cfs.webkitCancelFullScreen();
        }
        else {
            cfs.msExitFullscreen();
        }
    }
}                               